﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <!-- Documenting T:NAnt.Core.Types.FileSet-->
  <head>
    <meta http-equiv="Content-Language" content="en-ca" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="../style.css" />
    <title>&lt;fileset&gt; Type</title>
  </head>
  <body>
    <table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
      <tr>
        <td class="NavBar-Cell">
          <a href="http://nant.sourceforge.net">
            <b>NAnt</b>
          </a>
          <img alt="-&gt;" src="../images/arrow.gif" />
          <a href="../index.html">Help</a>
          <img alt="-&gt;" src="../images/arrow.gif" />
          <a href="../types/index.html">Type Reference</a>
          <img alt="-&gt;" src="../images/arrow.gif" /> &lt;fileset&gt;</td>
        <td class="NavBar-Cell" align="right">
                        v0.91</td>
      </tr>
    </table>
    <h1>&lt;fileset&gt;</h1>
    <p> Filesets are groups of files. These files can be found in a directory tree starting in a base directory and are matched by patterns taken from a number of patterns. Filesets can appear inside tasks that support this feature or at the project level, i.e., as children of <code>&lt;project&gt;</code>. </p>
    <h3>Patterns</h3>
    <p> As described earlier, patterns are used for the inclusion and exclusion. These patterns look very much like the patterns used in DOS and UNIX: </p>
    <ul style="list-style-type: disc;">
      <li>
        <p>'<code>*</code>' matches zero or more characters</p>
        <p>For example:</p>
        <p>
          <code>*.cs</code> matches <code>.cs</code>, <code>x.cs</code> and <code>FooBar.cs</code>, but not <code>FooBar.xml</code> (does not end with <code>.cs</code>). </p>
      </li>
      <li>
        <p>'<code>?</code>' matches one character</p>
        <p>For example:</p>
        <p>
          <code>?.cs</code> matches <code>x.cs</code>, <code>A.cs</code>, but not <code>.cs</code> or <code>xyz.cs</code> (both don't have one character before <code>.cs</code>). </p>
      </li>
    </ul>
    <p> Combinations of <code>*</code>'s and <code>?</code>'s are allowed. </p>
    <p> Matching is done per-directory. This means that first the first directory in the pattern is matched against the first directory in the path to match. Then the second directory is matched, and so on. For example, when we have the pattern <code>/?abc/*/*.cs</code> and the path <code>/xabc/foobar/test.cs</code>, the first <code>?abc</code> is matched with <code>xabc</code>, then <code>*</code> is matched with <code>foobar</code>, and finally <code>*.cs</code> is matched with <code>test.cs</code>. They all match, so the path matches the pattern. </p>
    <p> To make things a bit more flexible, we added one extra feature, which makes it possible to match multiple directory levels. This can be used to match a complete directory tree, or a file anywhere in the directory tree. To do this, <code>**</code> must be used as the name of a directory. When <code>**</code> is used as the name of a directory in the pattern, it matches zero or more directories. For example: <code>/test/**</code> matches all files/directories under <code>/test/</code>, such as <code>/test/x.cs</code>, or <code>/test/foo/bar/xyz.html</code>, but not <code>/xyz.xml</code>. </p>
    <p> There is one "shorthand" - if a pattern ends with <code>/</code> or <code>\</code>, then <code>**</code> is appended. For example, <code>mypackage/test/</code> is interpreted as if it were <code>mypackage/test/**</code>. </p>
    <h3>Case-Sensitivity</h3>
    <p> By default, pattern matching is case-sensitive on Unix and case-insensitive on other platforms. The <code>casesensitive</code> parameter can be used to override this. </p>
    <h3>Default Excludes</h3>
    <p> There are a set of definitions that are excluded by default from all tasks that use filesets. They are: </p>
    <ul style="list-style-type: disc;">
      <li>**/.svn</li>
      <li>**/.svn/**</li>
      <li>**/_svn</li>
      <li>**/_svn/**</li>
      <li>**/.git</li>
      <li>**/.git/**</li>
      <li>**/.git* (eg. .gitignore)</li>
      <li>**/.hg</li>
      <li>**/.hg/**</li>
      <li>**/.hg* (eg. .hgignore)</li>
      <li>**/SCCS</li>
      <li>**/SCCS/**</li>
      <li>**/vssver.scc</li>
      <li>**/vssver2.scc</li>
      <li>**/_vti_cnf/**</li>
      <li>**/*~</li>
      <li>**/#*#</li>
      <li>**/.#*</li>
      <li>**/%*%</li>
      <li>**/CVS</li>
      <li>**/CVS/**</li>
      <li>**/.cvsignore</li>
    </ul>
    <p> If you do not want these default excludes applied, you may disable them by setting <code>defaultexcludes</code> to <b>false</b>. </p>
    <h3>Parameters</h3>
    <div class="table">
      <table>
        <tr>
          <th>Attribute</th>
          <th style="text-align: center;">Type</th>
          <th>Description</th>
          <th style="text-align: center;">Required</th>
        </tr>
        <tr>
          <td valign="top">basedir</td>
          <td style="text-align: center;">directory</td>
          <td> The base of the directory of this fileset. The default is the project base directory. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">casesensitive</td>
          <td style="text-align: center;">bool</td>
          <td> Indicates whether include and exclude patterns must be treated in a case-sensitive way. The default is <b>true</b> on Unix; otherwise, <b>false</b>. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">defaultexcludes</td>
          <td style="text-align: center;">bool</td>
          <td> Indicates whether default excludes should be used or not. The default is <b>true</b>. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">failonempty</td>
          <td style="text-align: center;">bool</td>
          <td> When set to <b>true</b>, causes the fileset element to throw a <a href="../../sdk/NAnt.Core.ValidationException.html">ValidationException</a> when no files match the includes and excludes criteria. The default is <b>false</b>. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">id</td>
          <td style="text-align: center;">string</td>
          <td> The ID used to be referenced later. </td>
          <td style="text-align: center;">False</td>
        </tr>
        <tr>
          <td valign="top">refid</td>
          <td style="text-align: center;">string</td>
          <td> The ID to use as the reference. </td>
          <td style="text-align: center;">False</td>
        </tr>
      </table>
    </div>
    <h3>Nested Elements:</h3>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.Core.Types.FileSet.Include-->
    <h4>
      <a id="includes">
      </a>
                    &lt;includes&gt;
                </h4>
    <div class="nested-element">
      <i>Deprecated.</i>  The items to include in the fileset. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The pattern or file name to include. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">asis</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the file name will be added to the <a href="../types/fileset.html">&lt;fileset&gt;</a> without pattern matching or checking if the file exists. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">frompath</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the file will be searched for on the path. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the pattern will be included; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Opposite of <code>if</code>. If <b>false</b> then the pattern will be included; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
    <h4>
      <a id="includes">
      </a>
                    &lt;/includes&gt;
                </h4>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.Core.Types.FileSet.Include-->
    <h4>
      <a id="include">
      </a>
                    &lt;include&gt;
                </h4>
    <div class="nested-element"> The items to include in the fileset. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The pattern or file name to include. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">asis</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the file name will be added to the <a href="../types/fileset.html">&lt;fileset&gt;</a> without pattern matching or checking if the file exists. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">frompath</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the file will be searched for on the path. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the pattern will be included; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Opposite of <code>if</code>. If <b>false</b> then the pattern will be included; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
    <h4>
      <a id="include">
      </a>
                    &lt;/include&gt;
                </h4>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.Core.Types.FileSet.Exclude-->
    <h4>
      <a id="excludes">
      </a>
                    &lt;excludes&gt;
                </h4>
    <div class="nested-element">
      <i>Deprecated.</i>  The items to exclude from the fileset. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The pattern or file name to exclude. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the pattern will be excluded; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Opposite of <code>if</code>. If <b>false</b> then the pattern will be excluded; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
    <h4>
      <a id="excludes">
      </a>
                    &lt;/excludes&gt;
                </h4>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.Core.Types.FileSet.Exclude-->
    <h4>
      <a id="exclude">
      </a>
                    &lt;exclude&gt;
                </h4>
    <div class="nested-element"> The items to exclude from the fileset. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The pattern or file name to exclude. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the pattern will be excluded; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Opposite of <code>if</code>. If <b>false</b> then the pattern will be excluded; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
    <h4>
      <a id="exclude">
      </a>
                    &lt;/exclude&gt;
                </h4>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.Core.Types.FileSet.IncludesFile-->
    <h4>
      <a id="includesList">
      </a>
                    &lt;includesList&gt;
                </h4>
    <div class="nested-element">
      <i>Deprecated.</i>  The files from which a list of patterns or files to include should be obtained. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top">asis</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the patterns in the include file will be added to the <a href="../types/fileset.html">&lt;fileset&gt;</a> without pattern matching or checking if the file exists. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">frompath</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the patterns in the include file will be searched for on the path. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the patterns will be included; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Opposite of <code>if</code>. If <b>false</b> then the patterns will be included; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">file</td><td> The name of a file; each line of this file is taken to be a pattern. </td><td style="text-align: center;">True</td></tr></table></div></div>
    <h4>
      <a id="includesList">
      </a>
                    &lt;/includesList&gt;
                </h4>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.Core.Types.FileSet.IncludesFile-->
    <h4>
      <a id="includesfile">
      </a>
                    &lt;includesfile&gt;
                </h4>
    <div class="nested-element"> The files from which a list of patterns or files to include should be obtained. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top">asis</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the patterns in the include file will be added to the <a href="../types/fileset.html">&lt;fileset&gt;</a> without pattern matching or checking if the file exists. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">frompath</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the patterns in the include file will be searched for on the path. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the patterns will be included; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Opposite of <code>if</code>. If <b>false</b> then the patterns will be included; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">file</td><td> The name of a file; each line of this file is taken to be a pattern. </td><td style="text-align: center;">True</td></tr></table></div></div>
    <h4>
      <a id="includesfile">
      </a>
                    &lt;/includesfile&gt;
                </h4>
    <!--Array-->
    <!--NestedElementArray=T:NAnt.Core.Types.FileSet.ExcludesFile-->
    <h4>
      <a id="excludesfile">
      </a>
                    &lt;excludesfile&gt;
                </h4>
    <div class="nested-element"> The files from which a list of patterns or files to exclude should be obtained. <p></p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">file</td><td> The name of a file; each line of this file is taken to be a pattern. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> If <b>true</b> then the patterns will be excluded; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Opposite of <code>if</code>. If <b>false</b> then the patterns will be excluded; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr></table></div></div>
    <h4>
      <a id="excludesfile">
      </a>
                    &lt;/excludesfile&gt;
                </h4>
    <!--Element-->
    <h4>
      <a id="patternset">
      </a>
                    &lt;<a href="../types/patternset.html">patternset</a>&gt;
                </h4>
    <div class="nested-element"> Adds a nested set of patterns, or references a standalone patternset. <p /></div>
    <h4>
      <a id="patternset">
      </a>
                    &lt;/<a href="../types/patternset.html">patternset</a>&gt;
                </h4>
    <h3>Examples</h3>
    <ul class="examples">
      <li>
        <div class="table">
          <table>
            <tr>
              <th>Pattern</th>
              <th>Match</th>
            </tr>
            <tr>
              <td>
                <code>**/CVS/*</code>
              </td>
              <td>
                <p> Matches all files in <code>CVS</code> directories that can be located anywhere in the directory tree. </p>
                <p>Matches:</p>
                <ul style="list-style-type: disc;">
                  <li>CVS/Repository</li>
                  <li>org/apache/CVS/Entries</li>
                  <li>org/apache/jakarta/tools/ant/CVS/Entries</li>
                </ul>
                <p>But not:</p>
                <ul style="list-style-type: disc;">
                  <li>org/apache/CVS/foo/bar/Entries (<code>foo/bar/</code> part does not match)</li>
                </ul>
              </td>
            </tr>
            <tr>
              <td>
                <code>org/apache/jakarta/**</code>
              </td>
              <td>
                <p> Matches all files in the <code>org/apache/jakarta</code> directory tree. </p>
                <p>Matches:</p>
                <ul style="list-style-type: disc;">
                  <li>org/apache/jakarta/tools/ant/docs/index.html</li>
                  <li>org/apache/jakarta/test.xml</li>
                </ul>
                <p>But not:</p>
                <ul style="list-style-type: disc;">
                  <li>org/apache/xyz.java (<code>jakarta/</code> part is missing)</li>
                </ul>
              </td>
            </tr>
            <tr>
              <td>
                <code>org/apache/**/CVS/*</code>
              </td>
              <td>
                <p> Matches all files in <code>CVS</code> directories that are located anywhere in the directory tree under <code>org/apache</code>. </p>
                <p>Matches:</p>
                <ul style="list-style-type: disc;">
                  <li>org/apache/CVS/Entries</li>
                  <li>org/apache/jakarta/tools/ant/CVS/Entries</li>
                </ul>
                <p>But not:</p>
                <ul style="list-style-type: disc;">
                  <li>org/apache/CVS/foo/bar/Entries (<code>foo/bar/</code> part does not match)</li>
                </ul>
              </td>
            </tr>
            <tr>
              <td>
                <code>**/test/**</code>
              </td>
              <td>
                <p> Matches all files that have a <code>test</code> element in their path, including <code>test</code> as a filename. </p>
              </td>
            </tr>
          </table>
        </div>
      </li>
    </ul>
    <h3>Requirements</h3>
    <div style="margin-left: 20px;">
      <b>Assembly:</b> NAnt.Core (0.91.4312.0)
            </div>
    <h3>See Also</h3>
    <a href="../types/patternset.html">&lt;patternset&gt;</a>
  </body>
</html>